package train48days;
import java.util.*;
public class 查找兄弟单词 {
    public static boolean isBrother(char[] arr1,char[] arr2){
        if(arr1.length!=arr2.length){
            return false;
        }
        String s1 = new String(arr1);
        String s2 = new String(arr2);
        if(s1.equals(s2)){
            return false;
        }
        Arrays.sort(arr1);
        Arrays.sort(arr2);
        s1= new String(arr1);
        s2= new String(arr2);
        if (s1.equals(s2)){
            return true;
        }
        return false;
    }


    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while (sc.hasNext()) {
                int n = sc.nextInt();
                String[] arr = new String[n];
                for (int i = 0; i < n; i++) {
                    arr[i] = sc.next();
                }
                String x = sc.next();
                int k = sc.nextInt();

                Arrays.sort(arr);
                int count=0;
                String res="";
                for (String s :arr){
                    if (isBrother(s.toCharArray(),x.toCharArray())){
                        count++;
                        if (count==k){
                            res = s;
                        }
                    }
                }
                System.out.println(count);
                if (count>k){
                    System.out.println(res);
                }
            }
        }
    }
